<template>
  <div id="user_consumption">
    <div>
      <k-header headTitle="消费明细" goBack='true'/>
      <!-- <k-header headTitle="填写发票" goBack="true" rightTitle="提交" @rightClick="fillBtn"/> -->
    </div>
    <div class="month_list" :class="headIos?'side-fixd-ios':'side-fixed'">
      <group>
        <div class="thia_list" v-for="listdetail in detaillist" :key='listdetail.months' @click="consump(listdetail.months)">
          <cell :title="listdetail.months+'月'" is-link>
            <!-- <span class="month_money" slot="value">{{ listdetail.sumOrderTotal }}元</span> -->
          </cell>
        </div>
      </group>
    </div>
  </div>
</template>

<style scoped>
  .month_list {
    padding: 45px 0 0 0;
  }
  .side-fixd-ios {
    padding: 65px 0 0 0;
  }
  .weui-cell {
    padding: 10px !important;
  }
  .month_money {
    color: #F89721;
  }
  .thia_list {
    font-size: 1.4rem;
    border-bottom: 1px solid #f5f5f5;
  }
</style>

<script>
  import kHeader from '../common/head'
  import { Group, Cell } from 'vux'
  import util from '../../libs/util'
  export default {
    name: 'consumption',
    data() {
      return {
        detaillist: '',
        headIos: false
      }
    },
    components: {
      kHeader,
      Group,
      Cell
    },
    methods: {
      getdata: function() {
        var url = 'lblsapp-h5/v2/personCenter/monthConsumptionDetail.json';
        let that = this;
        util.ajax.post(url).then(function(stats) {
          console.log(stats.data.res.data);
          that.detaillist = stats.data.res.data;
        }).catch(function(error) {
          console.log(error);
        })
      },
      consump(k) {
        console.log(k);
        let s = k.split('-');
        let v = s[0]+s[1]+'01';
        this.$router.push({ path: '/userParticulars', query:{moths: v}})
      }
    },
    created() {
      if (window.navigator.userAgent.indexOf('LBLSIOS') > -1) {
        this.headIos = true;
      }
      this.getdata();
    }
  }
</script>


